<!-- 表单弹窗 -->
<form id="dict-data-form" lay-filter="dict-data-form" class="layui-form layui-form-pane" style="padding: 15px 15px 0px 15px">
    <input name="pid" type="hidden"/>
    <input name="dataType" type="hidden" th:value="${dictType}"/>
    <input name="parentId" type="hidden" />
    <div class="layui-form-item">
        <label class="layui-form-label"><i class="layui-icon required">&#xe642;</i>字典码值</label>
        <div class="layui-input-block">
            <input name="dataCode" placeholder="请输入字典码值" type="text" class="layui-input" maxlength="50"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><i class="layui-icon required">&#xe642;</i>字典名称</label>
        <div class="layui-input-block">
            <input name="dataText" placeholder="请输入字典名称" type="text" class="layui-input" maxlength="50"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item" pane>
        <label class="layui-form-label"><i class="layui-icon required">&#xe642;</i>是否可用</label>
        <div class="layui-input-block">
            <input type="radio" name="isEnable" value="1" title="是" checked/>
            <input type="radio" name="isEnable" value="0" title="否"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">分组代码</label>
        <div class="layui-input-block">
            <input type="text" name="groupCode" placeholder="请输入分组代码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">分组名称</label>
        <div class="layui-input-block">
            <input type="text" name="groupText" placeholder="请输入分组名称" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><i class="layui-icon required">&#xe642;</i>排序号</label>
        <div class="layui-input-block">
            <input type="text" name="dataPxh" lay-verify="number" placeholder="请输入排序号" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" pane>
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea name="memo" placeholder="请输入备注" class="layui-textarea" style="border: 0px;border-left: 1px solid #e6e6e6;"></textarea>
        </div>
    </div>
    <div class="layui-form-item model-form-footer">
        <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog"><i class="layui-icon">&#x1006;</i> 取消</button>
        <button class="layui-btn" lay-filter="dict-data-form-submit" lay-submit><i class="layui-icon">&#xe605;</i> 保存</button>
    </div>
</form>

<script>
    layui.use(['layer', 'jquery', 'sadmin', 'form'], function () {
        var $ = layui.$ //重点处
        var layer = layui.layer;
        var sadmin = layui.sadmin;
        var form = layui.form;

        form.render('radio');

        var url = 'system/dict/save';
        // 回显user数据
        var dict_data = sadmin.getTempData('system_dict_data');
    	$("input[name='parentId']").val(sadmin.getTempData('parentId'));
        if (dict_data) {
            form.val('dict-data-form', dict_data);
        }

        // 表单提交事件
        form.on('submit(dict-data-form-submit)', function (data) {
            layer.load(2);
            $.post(url, data.field, function (result) {
                layer.closeAll('loading');
                layer.msg(result.msg);
                sadmin.finishPopupCenter();
            });
            return false;
        });
    });
</script>